<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>查看</title>
    <link href="../../../layuiadmin/js/adm/css/bootstrap.css"  rel="stylesheet">
    <script src="../../../layuiadmin/js/adm/js/vue.js"></script>
    <script src="../../../layuiadmin/js/adm/js/vue-resource.js"></script>
    <script src="../../../layuiadmin/js/adm/js/jquery.min.js"></script>
    <script src="../../../layuiadmin/js/adm/js/bootstrap.js"></script>
    <script src="../../../layuiadmin/js/adm/js/getUrlParam.js"></script>
    <script src="../../../layuiadmin/js/adm/js/date.js"></script>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui@1.4/lib/theme-default/index.css">
    <!-- 引入组件库 -->
    <script src="https://unpkg.com/element-ui@1.4/lib/index.js"></script>
    <script src="../../../layuiadmin/js/adm/js/jquery.cookie.js"></script>
</head>
<body>
    <div id="app"  class="container-fluid">
        <h1 style="text-align: center;font-family: '幼圆'"><b>{{notice.title}}</b></h1>
        <p style="text-align: center; color: darkgrey">日期：{{notice.datetime|formatDate}}&nbsp;&nbsp;&nbsp;发布人： {{notice.userId.userName}}</p>
        <hr style="width: 90%">
        <p style="margin-left: 8%">{{notice.content}}</p>
        <br><br><span style="margin-left: 10%">已阅：{{uid}}</span>
    </div>
    

    <script>
          var vm=new Vue({
            el:'#app',
            data:{
                notice:{
                    noticeId:"",
                    userId:{
                        userId:"",
                        userName:""
                    },
                    title:"",
                    datetime:"",
                    uploading:"",
                    content:""
                },
                uid:""
            },
            methods: {
                postinfo(id){
                    var uid=$.cookie("redisId")
                    this.$http.post('http://localhost:8080/adm/rense',{"uid":uid},{emulateJSON:true}).then(result =>{
                         var msg=result.body
                         this.uid=msg
                    })
                    this.$http.post('http://localhost:8080/adm/queryinfo',{"id":id},{emulateJSON:true}).then(result =>{
                        var dat=eval("("+result.body+")")
                        this.notice=dat
                    })
                }
            },
            created () {
                var id = getUrlParam("id")
                this.postinfo(id)
            },
            filters: {
                formatDate: function (value) {      //将时间戳修改为时间单位格式
                    let date = new Date(value);
                    let y = date.getFullYear();
                    let MM = date.getMonth() + 1;
                    MM = MM < 10 ? ('0' + MM) : MM;
                    let d = date.getDate();
                    d = d < 10 ? ('0' + d) : d;
                    let h = date.getHours();
                    h = h < 10 ? ('0' + h) : h;
                    let m = date.getMinutes();
                    m = m < 10 ? ('0' + m) : m;
                    let s = date.getSeconds();
                    s = s < 10 ? ('0' + s) : s;
                    return y + '-' + MM + '-' + d ;
                    // return y + '-' + MM + '-' + d + 'T' + h + ':' + m ;
                }
            }
        })      
    </script>

</body>
</html>